<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;
use Carbon\Carbon;

class FreeCarResource extends JsonResource
{
    public function toArray($request)
    {
        Carbon::setLocale('zh');
        return [

            'id' => $this->id,
            'licensePlate' => $this->licensePlate,
            'constructionUnit' => $this->constructionUnit,
            'freeTimeStart' => $this->freeTimeStart,
            'freeTimeEnd' => $this->freeTimeEnd,
            'willDid' => Carbon::now()->addMonths(3)->gt(Carbon::parse($this->freeTimeEnd)),
            'freeSection' => $this->freeSection,
            'vehicleType' => $this->vehicleType,
            'theValidityPeriodOfTheAnnualInspectionOfTheVehicle' => $this->theValidityPeriodOfTheAnnualInspectionOfTheVehicle,
            'validityPeriodOfVehicleInsurance' => $this->validityPeriodOfVehicleInsurance,
            'updatedDate' => $this->updatedDate,
            'remark' => $this->remark,
        ];
    }
}
